<template>
<div>
  <table>
    <tr>
      <td>id</td>
      <td>名称</td>
      <td>状态</td>
      <td>物流</td>
      <td>操作</td>
      <td><van-button @click="delall">删除选中</van-button></td>
    </tr>
    <tr v-for="i in list">
      <td><input type="checkbox" :value="i.id" v-model="dlist">{{i.id}}</td>
      <td>{{i.name}}</td>
      <td v-if="i.status==1">未支付</td>
      <td v-else-if="i.status==2">已支付</td>
      <td v-else>已发货</td>
      <td>{{i.wuliu}}</td>
      <td><van-button @click="del(i.id)">删除</van-button></td>
      <van-uploader :after-read="upload"></van-uploader>
    </tr>
  </table>
  <van-pagination v-model="cpage" :total-items="total" :items-per-page="page_size" @change="changec"></van-pagination>

</div>
</template>

<script>
export default {
name: "add_wuliu",
data(){
return{
list:[],
total:0,
page_size:3,
cpage:1,
dlist:[]
}
},
methods:{
get_wuliu(){
this.$axios.get('/order?cpage='+this.cpage+'&page_size='+this.page_size).then(res=>{
if (res.data.code==200){
this.total = res.data.total
this.list = res.data.list
}
})
},
changec(cpage){
this.cpage = cpage
this.get_wuliu()
},
del(id){
this.$axios.delete('/order?id='+id)
.then(res=>{
if(res.data.code==200){
alert('删除成功')
this.get_wuliu()
}
})
},
delall(){
this.$axios.delete('/order1?dlist='+this.dlist).then(res=>{
if(res.data.code==200){
alert('删除成功')
this.get_wuliu()
}
})
},
upload(file){


}
},
mounted() {
this.get_wuliu()
}
}
</script>

<style scoped>

</style>
